

/**
 * @description 随机生成要连线的元素的索引
 * @param { number } leftNum 左边个数
 * @param {number } rightNum  右边个数
 */
function creatIndex(leftNum, rightNum) {
  let rightIndexs = getRightIndex(rightNum)
  let leftIndexs = getLeftIndexs(leftNum)

  return [leftIndexs, rightIndexs]
}

// 生成右边的索引，目前单个就行
function getRightIndex(rightNum) {
  let index = Math.floor(Math.random() * rightNum)
  return [index];
}

// 生成左边的
function getLeftIndexs(leftNum) {
  let list = []
  for (let index = 0; index < leftNum; index++) {
    // 0 不加 1添加
    Math.floor(Math.random() * 2) === 1 && list.push(index)
  }
  return list
}

export default creatIndex